import request from '@/utils/request'

// 获取客户信息列表(带分页)
export function getCustomerPoolList(data) {
  return request({
    url: '/api/crm/customer/pool',
    method: 'GET',
    data
  })
}
// 获取客户信息列表(带分页)
export function getCustomerList(data) {
  return request({
    url: '/api/crm/customer',
    method: 'GET',
    data
  })
}

// 获取客户信息列表(带分页)
export function getCustomerSelector(keyword) {
  return request({
    url: '/api/crm/customer/selector',
    method: 'GET',
    data: { keyword }
  })
}

// 添加客户信息
export function createCustomer(data) {
  return request({
    url: '/api/crm/customer',
    method: 'POST',
    data
  })
}

// 获取客户信息
export function getCustomerInfo(id) {
  return request({
    url: `/api/crm/customer/${id}`,
    method: 'GET'
  })
}

// 修改客户信息
export function updateCustomer(data) {
  return request({
    url: `/api/crm/customer/${data.id}`,
    method: 'PUT',
    data
  })
}

// 删除客户信息
export function delCustomer(id) {
  return request({
    url: `/api/crm/customer/${id}`,
    method: 'DELETE'
  })
}

// 分配
export function assignCustomer(data) {
  return request({
    url: `/api/crm/customer/operation/assign`,
    method: 'POST',
    data
  })
}
// 转移
export function transferCustomer(data) {
  return request({
    url: `/api/crm/customer/operation/transfer`,
    method: 'POST',
    data
  })
}
// 退回
export function backCustomer(data) {
  return request({
    url: `/api/crm/customer/operation/back`,
    method: 'POST',
    data
  })
}

// 升级
export function upCustomer(data) {
  return request({
    url: `/api/crm/customer/operation/up`,
    method: 'POST',
    data
  })
}
// 退回跟进
export function rollbackCustomer(data) {
  return request({
    url: `/api/crm/customer/operation/rollback`,
    method: 'POST',
    data
  })
}

// 定金
export function depositCustomer(data) {
  return request({
    url: `/api/crm/customer/operation/deposit`,
    method: 'POST',
    data
  })
}
// 尾款
export function retainageCustomer(data) {
  return request({
    url: `/api/crm/customer/operation/retainage`,
    method: 'POST',
    data
  })
}
export function getPaymentrecords() {
  return request({
    url: `/api/crm/customer/paymentrecords`,
    method: 'GET'
  })
}
